home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_0799 / 669 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  16.4 KB

  1. From: Torsten Scherer <itschere@techfak.uni-bielefeld.de>
  2. Subject: MiNT 1.09 diffs: XATTR for biosfs & more
  3. Date: Sun, 28 Nov 93 14:59:22 +0100
  4.  
  5. Hi there!
  6.  
  7. Here's finally the result of all my questions and/or discussions about the
  8. bios filesystem and the XATTR structure. I consider them being serious ideas
  9. and would like to have them officially included, that's why I tried to be so
  10. carefully and wanted to discuss this first.
  11.  
  12. It's true that the datime() method would provide more security if you
  13. couldn't directly access the bios_file structure via f->fc.index, but
  14. removing this would cause a major rewrite of the biosfs code and might
  15. end up in using a size-fixed list of bios_file's for which the fc.index
  16. field isn't really more than an index, plus some more troubles like what
  17. happens if you install an extra bios device but the internal datime() call
  18. doesn't know about this bios number. Ah, well, plus some more, perhaps.
  19.  
  20. So I choose the other way round that every external device driver can
  21. access this structure as described above and is fully responsible for time
  22. updates or any other trash it might perhaps want to do. To minimize the
  23. risk a bit, Dcntl() calls are now restricted to the superuser.
  24.  
  25. This shouldn't disturb you if you're using MiNT as a basis for MultiTOS,
  26. since you'll never be anybody else but the superuser, but will hopefully
  27. conform the ideas of most of the people using it for other purposes, like
  28. a UN*X like system.
  29.  
  30. Since this also involves changes in the fasttext driver, I've chosen to put
  31. the declaration of the bios_file into file.h, so that it can be easily
  32. accessed by it or any other future device drivers.
  33.  
  34. There are actually some more security changes, so here comes a brief list:
  35.  
  36. file.h, biosfs.c, fasttext.c:
  37. - added XATTR structure to bios files allowing them to have ownership, access
  38.     modes and timestamps like any(?) other file
  39. - restricted Dcntl() calls to the superuser to be a bit more secure
  40. - fixed a bug with links so that ls now works correct on them
  41.  
  42. mint.h, syscall.spp, bios.c:
  43. - introduced a flag variable "in_dos", which allows bios calls to determine
  44.     if they derived from a gemdos call or not. most important application:
  45.     rwabs() is now only allowed if you're either the superuser or it was
  46.     a gemdos call, thus making it impossible(?) for any other user to
  47.     trash the filesystem
  48.  
  49. tosfs.c:
  50. - changed the getxattr() call so that the "other user" bits are masked out, so
  51.     files will look like "rwxrwx---" and again only the superuser is
  52.     allowed to access TOS partitions. Is there a better way of protection?
  53. - changed the chown() call to report the change was successfully, cause I
  54.     was getting really annoyed by mv's error messages
  55.  
  56. so long,
  57. TeSche
  58. --
  59. PS: If the above written looks weird, then that's probably because it _is_.
  60. WhoDunnIt: Torsten Scherer (Schiller, Tesche, ...)
  61. Where: Faculty of Technology, University of Bielefeld, Germany
  62. EMail: itschere@techfak.uni-bielefeld.de / tesche@hrz.uni-bielefeld.de
  63.  
  64. --- cut cut cut ---
  65. diff -u4 orig/bios.c my/bios.c
  66. --- orig/bios.c    Fri Nov 19 15:33:56 1993
  67. +++ my/bios.c    Fri Nov 19 17:37:58 1993
  68. @@ -80,8 +80,11 @@
  69.  /* variables for monitoring the keyboard */
  70.  IOREC_T    *keyrec;        /* keyboard i/o record pointer */
  71.  short    kintr = 0;        /* keyboard interrupt pending (see intr.s) */
  72.  
  73. +/* TeSche: flag to recognize GEMDOS operations */
  74. +int    in_dos;
  75. +
  76.  /* Getmpb is not allowed under MiNT */
  77.  
  78.  long ARGS_ON_STACK
  79.  getmpb(ptr)
  80. @@ -305,8 +308,14 @@
  81.  long lrecno;
  82.  {
  83.      long r;
  84.      extern PROC *dlockproc[];    /* in dosdir.c */
  85. +
  86. +    /* TeSche: */
  87. +    if (curproc->euid && !in_dos) {
  88. +        DEBUG(("Rwabs by non-privileged process requested"));
  89. +        return EACCDN;
  90. +    }
  91.  
  92.      if (dev >= 0 && dev < NUM_DRIVES && dlockproc[dev]) {
  93.          if (dlockproc[dev] != curproc) {
  94.              DEBUG(("Rwabs: device %c is locked", dev+'A'));
  95. diff -u4 orig/biosfs.c my/biosfs.c
  96. --- orig/biosfs.c    Fri Nov 19 15:34:00 1993
  97. +++ my/biosfs.c    Mon Nov 29 09:13:20 1993
  98. @@ -108,20 +108,8 @@
  99.  
  100.  struct tty con_tty, aux_tty, midi_tty;
  101.  struct tty sccb_tty, scca_tty, ttmfp_tty;
  102.  
  103. -#define BNAME_MAX    13
  104. -
  105. -struct bios_file {
  106. -    char     name[BNAME_MAX+1];    /* device name */
  107. -    DEVDRV *device;            /* device driver for device */
  108. -    short    private;        /* extra info for device driver */
  109. -    ushort    flags;            /* flags for device open */
  110. -    struct tty *tty;        /* tty structure (if appropriate) */
  111. -    struct bios_file *next;
  112. -    short    lockpid;        /* owner of the lock */
  113. -};
  114. -
  115.  struct bios_file BDEV[] = {
  116.  
  117.  /* "real" bios devices present on all machines */
  118.      {"centr", &bios_ndevice, 0, 0, 0, 0},
  119. @@ -166,16 +154,54 @@
  120.   */
  121.  
  122.  FILEPTR *defaultaux;
  123.  
  124. +/* ts: a xattr field used for the root directory, 'cause there's no
  125. + * bios_file structure for it.
  126. + */
  127. +
  128. +XATTR rxattr;
  129. +
  130. +/* ts: a small utility function to set up a xattr structure
  131. + */
  132. +
  133. +void set_xattr(XATTR *xp, ushort mode)
  134. +{
  135. +    xp->mode = mode;
  136. +    xp->index = 0L;
  137. +    xp->dev = 0;
  138. +    xp->reserved1 = 0L;
  139. +    xp->nlink = 1;
  140. +    xp->uid = curproc->euid;
  141. +    xp->gid = curproc->egid;
  142. +    xp->size = 0L;
  143. +    xp->blksize = 1L;
  144. +    xp->nblocks = 0L;
  145. +/* timestamp/datestamp are not yet initialized when the biosfs comes up */
  146. +    xp->mtime = xp->atime = xp->ctime = Tgettime();
  147. +    xp->mdate = xp->adate = xp->cdate = Tgetdate();
  148. +/* root directory only */
  149. +    if ((mode & S_IFMT) == S_IFDIR)
  150. +        xp->attr = FA_DIR;
  151. +    else
  152. +        xp->attr = 0;
  153. +    xp->reserved2 = 0;
  154. +    xp->reserved3[0] = 0L;
  155. +    xp->reserved3[1] = 0L;
  156. +}
  157. +
  158.  void
  159.  biosfs_init()
  160.  {
  161.      struct bios_file *b;
  162.  
  163.      broot = BDEV;
  164. +    set_xattr(&rxattr, S_IFDIR | DEFAULT_DIRMODE);
  165.  
  166.      for (b = broot; b->name[0]; b++) {
  167. +
  168. +        set_xattr(&b->xattr, S_IFCHR | DEFAULT_MODE);
  169. +
  170.          b->next = b+1;
  171.  
  172.      /* if not a TT or Mega STE, adjust the MODEM1 device to be BIOS
  173.       * device 1
  174. @@ -270,32 +296,25 @@
  175.  {
  176.      FILEPTR *f;
  177.      struct bios_file *b = (struct bios_file *)fc->index;
  178.  
  179. -    xattr->index = fc->index;
  180. -    xattr->dev = fc->dev;
  181. -    xattr->nlink = 1;
  182. -    xattr->uid = xattr->gid = 0;
  183. -    xattr->size = xattr->nblocks = 0;
  184. -    xattr->blksize = 1;
  185. -    xattr->mtime = xattr->atime = xattr->ctime = timestamp;
  186. -    xattr->mdate = xattr->adate = xattr->cdate = datestamp;
  187. -    if (fc->index == 0) {        /* root directory? */
  188. -        xattr->mode = S_IFDIR | DEFAULT_DIRMODE;
  189. -        xattr->attr = FA_DIR;
  190. -    } else if (b->device == 0) {    /* symbolic link? */
  191. -        xattr->mode = S_IFLNK | DEFAULT_DIRMODE;
  192. -    } else if (b->device == &fakedev &&
  193. -        (f = curproc->handle[b->private]) != 0)
  194. -    {
  195. -        /* u:\dev\stdin, u:\dev\stdout, etc. */
  196. -        (*f->fc.fs->getxattr) (&f->fc, xattr);
  197. -        xattr->index = fc->index;
  198. -        xattr->dev = fc->dev;
  199. +    if (b == 0) {
  200. +        /* root directory */
  201. +        *xattr = rxattr;
  202. +        xattr->index = fc->index;
  203. +        xattr->dev = fc->dev;
  204. +    } else if (b->device == &fakedev && (f = curproc->handle[b->private]) != 0) {
  205. +        /* u:\dev\stdin, u:\dev\stdout, etc. */
  206. +        (*f->fc.fs->getxattr) (&f->fc, xattr);
  207. +        xattr->index = fc->index;
  208. +        xattr->dev = fc->dev;
  209.      } else {
  210. -        xattr->mode = S_IFCHR | DEFAULT_MODE;
  211. -        xattr->attr = 0;
  212. +        /* all the rest... */
  213. +        *xattr = b->xattr;
  214. +        xattr->index = fc->index;
  215. +        xattr->dev = fc->dev;
  216.      }
  217. +
  218.      return 0;
  219.  }
  220.  
  221.  static long ARGS_ON_STACK 
  222. @@ -311,20 +330,48 @@
  223.  bios_chown(fc, uid, gid)
  224.      fcookie *fc;
  225.      int uid, gid;
  226.  {
  227. -    UNUSED(fc); UNUSED(uid);
  228. -    UNUSED(gid);
  229. -    return EINVFN;
  230. +    struct bios_file *b = (struct bios_file *)fc->index;
  231. +
  232. +    if (!(curproc->euid)) {
  233. +        if (!b) {
  234. +            /* biosfs root directory */
  235. +            rxattr.uid = uid;
  236. +            rxattr.gid = gid;
  237. +        } else {
  238. +            /* any other entry */
  239. +            b->xattr.uid = uid;
  240. +            b->xattr.gid = gid;
  241. +        }
  242. +
  243. +        return 0;
  244. +    }
  245. +
  246. +    return EACCDN;
  247.  }
  248.  
  249.  static long ARGS_ON_STACK 
  250.  bios_chmode(fc, mode)
  251.      fcookie *fc;
  252.      unsigned mode;
  253.  {
  254. -    UNUSED(fc); UNUSED(mode);
  255. -    return EINVFN;
  256. +    struct bios_file *b = (struct bios_file *)fc->index;
  257. +
  258. +    if (!b) {
  259. +        /* root directory */
  260. +        if (!curproc->euid || (curproc->euid == rxattr.uid)) {
  261. +            rxattr.mode = (rxattr.mode & S_IFMT) | mode;
  262. +            return 0;
  263. +        }
  264. +    } else {
  265. +        if (!curproc->euid && (curproc->euid == b->xattr.uid)) {
  266. +            b->xattr.mode = (b->xattr.mode & S_IFMT) | mode;
  267. +            return 0;
  268. +        }
  269. +    }
  270. +
  271. +    return EACCDN;
  272.  }
  273.  
  274.  long ARGS_ON_STACK 
  275.  nomkdir(dir, name, mode)
  276. @@ -363,8 +410,13 @@
  277.          if (!stricmp(b->name, name)) break;
  278.      }
  279.      if (!b) return EFILNF;
  280.  
  281. +/* don't allow removal of the device if we don't own it */
  282. +    if (curproc->euid && (curproc->euid != b->xattr.uid)) {
  283. +        return EACCDN;
  284. +    }
  285. +
  286.  /* don't allow removal of the basic system devices */
  287.      if (b >= BDEV && b <= bdevlast) {
  288.          return EACCDN;
  289.      }
  290. @@ -551,13 +603,24 @@
  291.  {
  292.      struct bios_file *b;
  293.  
  294.      UNUSED(dir);
  295. +
  296. +    /* TeSche: */
  297. +    if (curproc->euid) {
  298. +        DEBUG(("biosfs: device install by non-privileged process requested"));
  299. +        if ((unsigned)cmd) == DEV_INSTALL)
  300. +            return 0;
  301. +        else
  302. +            return EACCDN;
  303. +    }
  304. +
  305.      if ((unsigned)cmd == DEV_INSTALL) {
  306.          struct dev_descr *d = (struct dev_descr *)arg;
  307.  
  308.          b = kmalloc(SIZEOF(struct bios_file));
  309.          if (!b) return 0;
  310. +        set_xattr(&(b->xattr), S_IFCHR | DEFAULT_MODE);
  311.          strncpy(b->name, name, BNAME_MAX);
  312.          b->name[BNAME_MAX] = 0;
  313.          b->device = d->driver;
  314.          b->private = d->dinfo;
  315. @@ -569,8 +632,9 @@
  316.      }
  317.      if ((unsigned)cmd == DEV_NEWTTY) {
  318.          b = kmalloc(SIZEOF(struct bios_file));
  319.          if (!b) return ENSMEM;
  320. +        set_xattr(&(b->xattr), S_IFCHR | DEFAULT_MODE);
  321.          b->tty = kmalloc(SIZEOF(struct tty));
  322.          if (!b->tty) {
  323.              kfree(b);
  324.              return ENSMEM;
  325. @@ -587,8 +651,9 @@
  326.      }
  327.      if ((unsigned)cmd == DEV_NEWBIOS) {
  328.          b = kmalloc(SIZEOF(struct bios_file));
  329.          if (!b) return ENSMEM;
  330. +        set_xattr(&(b->xattr), S_IFCHR | DEFAULT_MODE);
  331.          strncpy(b->name, name, BNAME_MAX);
  332.          b->name[BNAME_MAX] = 0;
  333.          b->tty = 0;
  334.          b->device = &bios_ndevice;
  335. @@ -609,27 +674,38 @@
  336.      long r;
  337.      fcookie fc;
  338.  
  339.      r = bios_lookup(dir, name, &fc);
  340. -    if (r == 0) return EACCDN;    /* file already exists */
  341. -    if (r != EFILNF) return r;    /* some other error */
  342. +    if (r == 0)
  343. +        return EACCDN;    /* file already exists */
  344.  
  345. +    if (r != EFILNF)
  346. +        return r;    /* some other error */
  347. +
  348.      b = kmalloc(SIZEOF(struct bios_file));
  349. -    if (!b) return EACCDN;
  350. +    if (!b)
  351. +        return EACCDN;
  352.  
  353.      strncpy(b->name, name, BNAME_MAX);
  354.      b->name[BNAME_MAX] = 0;
  355.      b->device = 0;
  356.      b->private = EINVFN;
  357.      b->flags = 0;
  358. -    b->tty = kmalloc((long)strlen(to)+1);
  359. +
  360. +    b->tty = kmalloc(strlen(to)+1);
  361.      if (!b->tty) {
  362.          kfree(b);
  363.          return EACCDN;
  364.      }
  365. +
  366.      strcpy((char *)b->tty, to);
  367. +
  368. +    set_xattr(&b->xattr, S_IFLNK | DEFAULT_DIRMODE);
  369. +    b->xattr.size = strlen(to)+1;    /* this must include the \0 */
  370. +
  371.      b->next = broot;
  372.      broot = b;
  373. +
  374.      return 0;
  375.  }
  376.  
  377.  static long ARGS_ON_STACK 
  378. @@ -639,10 +715,13 @@
  379.      int buflen;
  380.  {
  381.      struct bios_file *b = (struct bios_file *)fc->index;
  382.  
  383. -    if (!b) return EINVFN;
  384. -    if (b->device) return EINVFN;
  385. +    if (!b)
  386. +        return EINVFN;
  387. +
  388. +    if (b->device)
  389. +        return EINVFN;
  390.  
  391.      strncpy(buf, (char *)b->tty, buflen);
  392.      if (strlen((char *)b->tty) >= buflen)
  393.          return ENAMETOOLONG;
  394. @@ -783,18 +862,31 @@
  395.  long ARGS_ON_STACK 
  396.  null_write(f, buf, bytes)
  397.      FILEPTR *f; const char *buf; long bytes;
  398.  {
  399. -    UNUSED(f); UNUSED(buf);
  400. +    struct bios_file *b = (struct bios_file *)f->fc.index;
  401. +
  402. +    UNUSED(buf);
  403. +    if (bytes > 0) {
  404. +        b->xattr.mtime = timestamp;
  405. +        b->xattr.mdate = datestamp;
  406. +    }
  407. +
  408.      return bytes;
  409.  }
  410.  
  411.  long ARGS_ON_STACK 
  412.  null_read(f, buf, bytes)
  413.      FILEPTR *f; char *buf; long bytes;
  414.  {
  415. -    UNUSED(f); UNUSED(buf);
  416. -    UNUSED(bytes);
  417. +    struct bios_file *b = (struct bios_file *)f->fc.index;
  418. +
  419. +    UNUSED(buf);
  420. +    if (bytes > 0) {
  421. +        b->xattr.atime = timestamp;
  422. +        b->xattr.adate = datestamp;
  423. +    }
  424. +
  425.      return 0;
  426.  }
  427.  
  428.  long ARGS_ON_STACK 
  429. @@ -891,8 +983,9 @@
  430.  {
  431.      long *r;
  432.      long ret = 0;
  433.      int bdev = f->fc.aux;
  434. +    struct bios_file *b = (struct bios_file *)f->fc.index;
  435.  
  436.      r = (long *)buf;
  437.  
  438.  /* Check for control characters on any newline output.
  439. @@ -920,8 +1013,13 @@
  440.      }
  441.  #if 0
  442.      (void)checkkeys();
  443.  #endif
  444. +    if (ret > 0) {
  445. +        b->xattr.mtime = timestamp;
  446. +        b->xattr.mdate = datestamp;
  447. +    }
  448. +
  449.      return ret;
  450.  }
  451.  
  452.  static long ARGS_ON_STACK 
  453. @@ -929,8 +1027,9 @@
  454.      FILEPTR *f; char *buf; long bytes;
  455.  {
  456.      long *r, ret = 0;
  457.      int bdev = f->fc.aux;
  458. +    struct bios_file *b = (struct bios_file *)f->fc.index;
  459.  
  460.      r = (long *)buf;
  461.  
  462.      if ((f->flags & O_NDELAY)) {
  463. @@ -945,8 +1044,12 @@
  464.              *r++ = bconin(bdev) & 0x7fffffffL;
  465.              bytes -= 4; ret += 4;
  466.          }
  467.      }
  468. +    if (ret > 0) {
  469. +        b->xattr.atime = timestamp;
  470. +        b->xattr.adate = datestamp;
  471. +    }
  472.      return ret;
  473.  }
  474.  
  475.  /*
  476. @@ -960,8 +1063,9 @@
  477.  {
  478.      long ret = 0;
  479.      int bdev = f->fc.aux;
  480.      int c;
  481. +    struct bios_file *b = (struct bios_file *)f->fc.index;
  482.  
  483.      while (bytes > 0) {
  484.          if ( (f->flags & O_NDELAY) && !bcostat(bdev) )
  485.              break;
  486. @@ -972,8 +1076,12 @@
  487.              break;
  488.  
  489.          bytes--; ret++;
  490.      }
  491. +    if (ret > 0) {
  492. +        b->xattr.mtime = timestamp;
  493. +        b->xattr.mdate = datestamp;
  494. +    }
  495.      return ret;
  496.  }
  497.  
  498.  static long ARGS_ON_STACK 
  499. @@ -981,15 +1089,20 @@
  500.      FILEPTR *f; char *buf; long bytes;
  501.  {
  502.      long ret = 0;
  503.      int bdev = f->fc.aux;
  504. +    struct bios_file *b = (struct bios_file *)f->fc.index;
  505.  
  506.      while (bytes > 0) {
  507.          if ( (f->flags & O_NDELAY) && !bconstat(bdev) )
  508.              break;
  509.          *buf++ = bconin(bdev) & 0xff;
  510.          bytes--; ret++;
  511.      }
  512. +    if (ret > 0) {
  513. +        b->xattr.atime = timestamp;
  514. +        b->xattr.adate = datestamp;
  515. +    }
  516.      return ret;
  517.  }
  518.  
  519.  /*
  520. @@ -1422,8 +1535,9 @@
  521.  {
  522.      long count = 0;
  523.      int mhead;
  524.      unsigned char *foo;
  525. +    struct bios_file *b = (struct bios_file *)f->fc.index;
  526.  
  527.      mhead = mousehead;
  528.      foo = &mousebuf[mhead];
  529.  
  530. @@ -1445,8 +1559,12 @@
  531.          count++;
  532.          --nbytes;
  533.      }
  534.      mousehead = mhead;
  535. +    if (count > 0) {
  536. +        b->xattr.atime = timestamp;
  537. +        b->xattr.adate = datestamp;
  538. +    }
  539.      return count;
  540.  }
  541.  
  542.  static long ARGS_ON_STACK 
  543. diff -u4 orig/fasttext.c my/fasttext.c
  544. --- orig/fasttext.c    Fri Nov 19 15:34:18 1993
  545. +++ my/fasttext.c    Sat Nov 27 18:33:42 1993
  546. @@ -1221,8 +1221,9 @@
  547.  static long ARGS_ON_STACK 
  548.  screen_write(f, buf, bytes)
  549.      FILEPTR *f; const char *buf; long bytes;
  550.  {
  551. +    struct bios_file *b = (struct bios_file *)f->fc.index;
  552.      SCREEN *v = current;
  553.      long *r;
  554.      long ret = 0;
  555.      int c;
  556. @@ -1244,15 +1245,20 @@
  557.      else
  558.          v->hidecnt = 0;
  559.      curs_on(v);
  560.      v->flags &= ~CURS_UPD;
  561. +    if (ret > 0) {
  562. +        b->xattr.mtime = timestamp;
  563. +        b->xattr.mdate = datestamp;
  564. +    }
  565.      return ret;
  566.  }
  567.  
  568.  static long ARGS_ON_STACK 
  569.  screen_read(f, buf, bytes)
  570.      FILEPTR *f; char *buf; long bytes;
  571.  {
  572. +    struct bios_file *b = (struct bios_file *)f->fc.index;
  573.      long *r, ret = 0;
  574.  
  575.      r = (long *)buf;
  576.  
  577. @@ -1260,8 +1266,12 @@
  578.          if ( (f->flags & O_NDELAY) && !bconstat(CONDEV) )
  579.              break;
  580.          *r++ = bconin(CONDEV) & 0x7fffffffL;
  581.          bytes -= 4; ret += 4;
  582. +    }
  583. +    if (ret > 0) {
  584. +        b->xattr.atime = timestamp;
  585. +        b->xattr.adate = datestamp;
  586.      }
  587.      return ret;
  588.  }
  589.  
  590. diff -u4 orig/file.h my/file.h
  591. --- orig/file.h    Fri Nov 19 15:34:20 1993
  592. +++ my/file.h    Sat Nov 27 18:32:28 1993
  593. @@ -550,5 +550,20 @@
  594.  extern struct tty default_tty;
  595.  extern char follow_links[];
  596.  #endif
  597.  
  598. +/* internal bios file structure */
  599. +
  600. +#define    BNAME_MAX    13
  601. +
  602. +struct bios_file {
  603. +    char     name[BNAME_MAX+1];    /* device name */
  604. +    DEVDRV *device;            /* device driver for device */
  605. +    short    private;        /* extra info for device driver */
  606. +    ushort    flags;            /* flags for device open */
  607. +    struct tty *tty;        /* tty structure (if appropriate) */
  608. +    struct bios_file *next;
  609. +    short    lockpid;        /* owner of the lock */
  610. +    XATTR    xattr;            /* guess what... */
  611. +};
  612. +
  613.  #endif /* _filesys_h */
  614. diff -u4 orig/mint.h my/mint.h
  615. --- orig/mint.h    Fri Nov 19 15:34:32 1993
  616. +++ my/mint.h    Fri Nov 19 17:01:02 1993
  617. @@ -228,5 +228,7 @@
  618.   * load some inline functions, perhaps
  619.   */
  620.  #include "inline.h"
  621.  
  622. +extern int in_dos;    /* TeSche: see bios.c & syscall.spp */
  623. +
  624.  #endif /* GENMAGIC */
  625. diff -u4 orig/syscall.spp my/syscall.spp
  626. --- orig/syscall.spp    Fri Nov 19 15:34:44 1993
  627. +++ my/syscall.spp    Fri Nov 19 17:35:04 1993
  628. @@ -66,10 +66,12 @@
  629.      XREF    _bconbuf,_bconbsiz,_bconbdev
  630.      XREF    _bflush
  631.  
  632.      XREF    _ubconstat,_do_bconin,_ubcostat,_kbshift
  633. -    
  634. +    XREF    _in_dos
  635. +
  636.  _mint_dos:
  637. +    move.w    #1,_in_dos        ; GEMDOS flag
  638.      clr.w    -(sp)            ; no frame format needed
  639.  ; NOTE: FOR NOW, WE PRESERVE A0 ACROSS GEMDOS CALLS. THIS WILL CHANGE
  640.  ; SOMEDAY, DON'T RELY ON IT!!!
  641.      move.l    _curproc,d0        ; note: preserve all regs but d0
  642. @@ -268,8 +270,9 @@
  643.      addq.w    #2,sp            ; pop function number off stack
  644.      move.l    d0,a0
  645.      jsr    (a0)            ; go do the call
  646.  out:
  647. +    clr.w    _in_dos            ; GEMDOS flag
  648.      move.l    _curproc,a0
  649.      move.l    d0,P_SYSCTXT+C_D0(a0)    ; set d0 in the saved context
  650.      move.w    P_SYSCTXT+C_SR(a0),d0    ; get saved status register
  651.      
  652. diff -u4 orig/tosfs.c my/tosfs.c
  653. --- orig/tosfs.c    Fri Nov 19 15:34:48 1993
  654. +++ my/tosfs.c    Wed Nov 24 09:01:06 1993
  655. @@ -583,8 +583,13 @@
  656.      if (ti->attr & FA_EXEC) {
  657.          xattr->mode |= (S_IXUSR|S_IXGRP|S_IXOTH);
  658.      }
  659.      xattr->attr = ti->attr & 0xff;
  660. +
  661. +    xattr->mode &= ~S_IROTH;
  662. +    xattr->mode &= ~S_IWOTH;
  663. +    xattr->mode &= ~S_IXOTH;
  664. +
  665.      return 0;
  666.  }
  667.  
  668.  static long ARGS_ON_STACK
  669. @@ -608,9 +613,10 @@
  670.      fcookie *dir;
  671.      int uid, gid;
  672.  {
  673.      UNUSED(dir); UNUSED(uid); UNUSED(gid);
  674. -    return EINVFN;
  675. +/* ts: ignore errors */
  676. +    return 0;
  677.  }
  678.  
  679.  static long ARGS_ON_STACK 
  680.  tos_chmode(fc, mode)
  681.